import 'package:favourcate/core/viewmodel/favor_view_model.dart';
import 'package:favourcate/ui/shared/app_theme.dart';
import 'package:favourcate/ui/widgets/meal_item.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class GLFavorContent extends StatelessWidget {
  const GLFavorContent({ Key? key }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Consumer<GLFavorViewModel>(
      builder: (ctx, favorStore, child) {
        
        if (favorStore.favorMeals.isEmpty) {
          return const Center(
            child: Text('未收藏～～')
          );
        }
        return ListView.builder(
          itemCount: favorStore.favorMeals.length,
          itemBuilder: (BuildContext itemCtx, int index) {
            return GLMealItem(favorStore.favorMeals[index]);
          },
        );
      },
    );
  }
}